package com.controller;

import java.util.logging.Logger;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import com.util.service.RedisService;


@Controller
public class RedisController {
	
	Log log = LogFactory.getLog(RedisController.class);
	
	@Autowired
	private RedisService redisService;
	
	
	@GetMapping("/redisSet")
	public String redisSet() {
		redisService.stringSet("name",Math.random()+"");
		return "index";
	}
	
	@GetMapping("/redisTest")
	public String redisTest() {
		Object obj = redisService.stringGet("name");
		System.out.println(obj);
		log.info("获取的redis【name："+obj+"】");
		return "index";
	}
}
